package com.joker.warehouse.service.impl;

import com.joker.common.security.utils.SecurityUtils;
import com.joker.warehouse.domain.PurchaseNeed;
import com.joker.warehouse.domain.vo.PurchaseNeedVO;
import com.joker.warehouse.mapper.NeedMapper;
import com.joker.warehouse.service.INeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lemon
 * @date 2025/01/13 20:22
 **/
@Service
public class NeedServiceImpl implements INeedService {

    @Autowired
    private NeedMapper needMapper;

    @Override
    public void createNeed(Long skuId) {
        PurchaseNeed purchaseNeed = new PurchaseNeed();
        purchaseNeed.setCreator(SecurityUtils.getUserId());
        purchaseNeed.setSkuId(skuId);
        needMapper.insert(purchaseNeed);
    }

    @Override
    public List<PurchaseNeedVO> selectBySuppId(Long supplierId) {
        return needMapper.selectBySuppId(supplierId);
    }

    @Override
    public void complete(List<Long> ids) {
        needMapper.updateStatus(ids);
    }
}
